import { MonsterAttackInfo } from "./info/MonsterAttackInfo";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { AttackInfoType } from "./info/AttackInfoType";
type int = number;
//class MonsterAttackConfig
    
    export  class MonsterAttackConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (MonsterAttackConfig._instance != null) 
            {
                throw new Error(" MonsterAttackConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1.monsterAttack;
            for(loc2 of loc4) 
            {
                loc1 = new MonsterAttackInfo();
                loc1.code = loc2.code;
                loc1.itemName = loc2.itemName;
                loc1.type = loc2.type;
                loc1.itemLength = loc2.itemLength;
                this._map[loc2.code] = loc1;
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getObjectByFileName("monsterAttack.xml");
            this.write(loc1);
            return;
        }

        public getAttackInfo(arg1: int): MonsterAttackInfo
        {
            return this._map[arg1];
        }

        public getPetExploreAttackInfo(arg1: int): MonsterAttackInfo
        {
            var loc1=this.getAttackInfo[arg1];
            if (loc1.type == AttackInfoType.All || loc1.type == AttackInfoType.PetExplore) 
            {
                return loc1;
            }
            return null;
        }

        public getNewBattlefieldAttackInfo(arg1: int): MonsterAttackInfo
        {
            var loc1=this.getAttackInfo[arg1];
            if (loc1.type == AttackInfoType.All || loc1.type == AttackInfoType.NewBattle) 
            {
                return loc1;
            }
            return null;
        }

        public static get instance(): MonsterAttackConfig
        {
            if (MonsterAttackConfig._instance == null) 
            {
                MonsterAttackConfig._instance = new MonsterAttackConfig();
            }
            return MonsterAttackConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: MonsterAttackConfig;
    }
